package day06;
//方法
public class MethodDemo {
    public static void main(String[] args) {
        say();
        sayHi("lyf");
        sayHello("lisi", 23);
        sayHello("zhnagsan", 90);

        double a = getNum();

        int d = plus(10, 20);
        System.out.println(d);

        int b = 10, b1 = 10;
        int c = plus(b, b1);
        System.out.println(c);

        int[] f = testArray(20, 100);
        System.out.println("长度为：" + f.length);
        int[] g = testArray(20, 100);
        int max = g[0];
        for (int i = 0; i < g.length; i++) {
            if (g[i] > max) {
                max = g[i];
            }
        }
        System.out.println(max);
        for (int i = 0; i < g.length; i++) {
            System.out.print(g[i] + " ");
        }
    }

    public static int[] testArray(int len, int max) {
        int[] arr = new int[len];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * (max + 1));
        }
        return arr;
    }

    public static int plus(int a, int b) {
        int num = a + b;
        return num;
    }

    public static double getNum() {
        return 9.99;
    }

    public static void sayHello(String name, int age) {
        if (age > 80) {
            return;
        }
        System.out.println("我叫" + name + "今年" + age + "岁了");
    }

    public static void sayHi(String name) {
        System.out.println("我叫" + name + "今年23岁了");
    }

    public static void say() {
        System.out.println("123");
    }

}



/*

        aMethod();
        System.out.println(444);
    }
    public static void aMethod(){
        System.out.println(111);
        bMethod();//嵌套调用
        System.out.println(222);
    }
    public static void bMethod(){
        System.out.println(333);
    }
}*/
